<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.fick.hibernate.dao.LinkDAO"%>
<%@page import="com.fick.hibernate.model.Link"%>
<%@page import="com.fick.hibernate.model.Media"%>
<%@page import="com.fick.hibernate.dao.MediaDAO"%>
<%@page import="java.io.*" %>
<%
	String hql = " where isPic='4'";
LinkDAO linkDao = new LinkDAO();
Link link = new Link();

List li2=null;
	li2 = linkDao.findPageByHql(hql+" order by linkOrder desc",1,50);
	if(li2 != null && li2.size() != 0 )
	for( int i = 0 ; i < li2.size() ; i ++ ){
		link = (Link)li2.get(i);
		if(link.getWebUrl().contains(".swf"))
	break;
	}
%>
<script type="text/javascript" src="js/swfobject.js"></script>
<table width="235" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="28" align="right" valign="bottom" background="images/right_top.gif"><table width="218" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="25" align="left" valign="middle" class="dhwz_wz3">在线视频</td>
                <td width="60" align="left" valign="middle" class="more1"><a href="media_list.jsp">更多&gt;&gt;</a></td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td height="210" align="center" valign="middle" background="images/right_cent.gif">
          <table width="230" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="180" align="center" valign="middle">
              <%
              	MediaDAO mediaDAO = new MediaDAO();	
                            	List listMedia=mediaDAO.findPage(1,10,"where mediaStatus='1'  order by mediaOrder");
                            		if( listMedia!=null && listMedia.size()>0)
                            		{
                            		Media media = (Media)listMedia.get(0);
              %>	
    <%
		if (media.getMediaUrl() != null) {
			String url = media.getMediaUrl();
			String type = url.substring(url.lastIndexOf("."), url.length());
			java.io.File mediaFile = new File(request.getSession().getServletContext().getRealPath("/")+url);
			
			if (mediaFile.exists() && (type.equals(".flv") || type.equals(".swf"))) {
	%>
<div id="player5" style="width:220px; margin:0px; border:solid 5px #50031a;color:#ffffff;" >
</div>
<script type="text/javascript">
function tex(name){
  var result = escape(name);
   result=result.replace(/%/g,"\\");
   return result;
}
var mediaUrl = tex('<%=media.getMediaUrl() %>');
	var s5 = new SWFObject("images/FlvPlayer201002.swf","playlist","220","180","7");
	s5.addParam("allowfullscreen","true");
	s5.addVariable("autostart","false");
	s5.addVariable("image","<%=media.getMediaIco() %>");
	s5.addVariable("file","<%=url %>");
	s5.addVariable("width","230");
	s5.addVariable("height","180");
	s5.write("player5");
</script>
              </td>
            </tr>
            <tr>
              <td height="22" align="center" valign="middle"><%=media.getMediaName() %>
              	
	<%
			}
		}}
	%>		
              </td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td height="3" background="images/right_bot.gif"></td>
        </tr>
      </table>
      <table width="235" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="7"></td>
        </tr>
      </table>